<?php

abstract class Buzz_AuthedController extends Zend_Controller_Action {
    public final function preDispatch() {
        if (!Zend_Auth::getInstance()->hasIdentity()) {
            $this->_helper->redirector('index', 'user');
        } else {
            $this->view->user = Zend_Auth::getInstance()->getIdentity();
            $this->session = new Zend_Session_Namespace("kollekthor");
            if (!isset($this->session->filter)) {
                $this->session->filter = "name DESC";
            }
        }
        $this->view->filter = $this->session->filter;
        $this->doPreDispatch();
    }

    protected abstract function doPreDispatch();

    public final function changefilterAction() {
        $this->session->filter = $this->getRequest()->getParam("filter", "name DESC");
        $this->_helper->json(array());
    }
}